package cn.stronglink.netrequest.business.check;


import com.google.gson.Gson;

import java.util.HashMap;
import java.util.Map;

import cn.stronglink.netrequest.util.HttpURL;
import cn.stronglink.netrequest.util.HttpUtil;
import okhttp3.Callback;

/**
 * Created by Tgb on 2018/6/5.
 * 验收
 */

public class CheckService {
    private Gson gson = new Gson();

    public void downloadPresetWorkOrder(Callback callback) throws Exception {
        Map<String, String> map = new HashMap<>();
        String json = gson.toJson(map);
        HttpUtil.httpPost(HttpURL.URL_PRESET_WORK_ORDER, json, callback);
    }

    public void uploadCheckList(String json, Callback callback) throws Exception {
        HttpUtil.httpPost(HttpURL.URL_UPLOAD_PRESET_WORK_ORDER, json, callback);
    }

    public String uploadCheckList(String json) throws Exception {
        return HttpUtil.httpPostAsync(HttpURL.URL_UPLOAD_PRESET_WORK_ORDER, json);
    }

    public String downloadPresetWorkOrder(String userId) throws Exception {
        Map<String, String> map = new HashMap<>();
        map.put("userId", userId);
        String json = gson.toJson(map);
        return HttpUtil.httpPostAsync(HttpURL.URL_PRESET_WORK_ORDER, json);
    }

}
